package com.chao.product.conf;

import org.springframework.amqp.rabbit.connection.CorrelationData;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.context.annotation.Configuration;

@Configuration
public class MyConfirmCallback implements RabbitTemplate.ConfirmCallback{

    //消息从channel 发送到 exchange时找不到对应的交换机 这个时候会失败
    @Override
    public void confirm(CorrelationData correlationData, boolean ack, String content) {
        if(ack){
            System.out.println("发送成功:" + content);
        }else{
            System.out.println("发送失败:" + content);
        }
    }
}
